package com.helloworld.fiberflax.tool;

import com.helloworld.fiberflax.Fiberflax;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import static com.helloworld.fiberflax.Fiberflax.FIBERFLAX_CREATIVE_TAB;

public class FiberfalxAxe extends ItemAxe {
    public FiberfalxAxe(ToolMaterial material, float damage, float speed) {
        super(material, damage, speed);
        setCreativeTab(FIBERFLAX_CREATIVE_TAB);
        setRegistryName(new ResourceLocation(Fiberflax.MODID,"item_fiberflax_axe"));
    }

    @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
        playerIn.addPotionEffect(new PotionEffect(MobEffects.SPEED,40,10));
        playerIn.getHeldItem(handIn).damageItem(25,playerIn);
        return super.onItemRightClick(worldIn, playerIn, handIn);
    }
}
